<template>
  <div>
        <button @click="isShow = !isShow">显示/隐藏</button>
        <transition name="hello" appear="">
            <h2 v-show="isShow">北极星</h2>
        </transition>
  </div>
</template>
<script>
export default {
    data(){
        return{
            isShow: true
        }
    }
}
</script>
<style scoped>
    h2{
        background-color: orange;
    }
    .hello-enter-active{
        animation: polaris 1s;
    }
    .hello-leave-active{
        animation: polaris 1s reverse;
    }

    @keyframes polaris{
        from{
            transform: translateX(-100%);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>